package com.juyu.miliao.authentication.dao.mysql;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class MakeMoneyDao {
    @Resource
    private SqlSession sqlSession;

//    public int getMakeMoneyDepositSum(long userId){
//        return sqlSession.selectOne("getMakeMoneyDepositSum", userId);
//    }
//
//    public List<MakeMoney> getMakeMoneyInfoList(Long userId) {
//        return sqlSession.selectList("getMakeMoneyInfoList",userId);
//    }


    public int getCountVerifyOpenId(String verifyOpenId) {
        return sqlSession.selectOne("getCountVerifyOpenId", verifyOpenId);
    }

    public int getCountVerifyDeviceNo(String deviceNo) {
        return sqlSession.selectOne("getCountVerifyDeviceNo", deviceNo);
    }

    public int insertMakeMoney(String activeUserId, long passiveUserId, int deposit,
                               String verifyOpenId, String deviceNo) {
        Map<String, Object> params = new HashMap<>();
        params.put("activeUserId", activeUserId);
        params.put("passiveUserId", passiveUserId);
        params.put("deposit",deposit);
        params.put("verifyOpenId",verifyOpenId);
        params.put("deviceNo",deviceNo);
        return sqlSession.insert("insertMakeMoney",params);
    }
}

